<template>
  <div class="wrapper" @click="hanleClose">
    <div class="content">
      <swiper :options="swiperOption">
        <swiper-slide v-for="item of list" :key="item.id">
          <img :src="item.imgUrl" alt="">
        </swiper-slide>
        <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Gallery',
  props: {
    list: {
      type: Array
    }
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observer: true,
        observeParents: true
      }
    }
  },
  methods: {
    hanleClose () {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .wrapper >>> .swiper-container
    overflow inherit
    width 100%
    position absolute
    top 50%
    transform translateY(-50%)
  .wrapper >>> .swiper-pagination
    bottom -300px
    color #fff
  .wrapper
    position fixed
    height 1334px
    top 0
    left 0
    bottom 0
    right 0
    z-index 10
    background-color #000
    display flex
    flex-direction column
    justify-content center
    .content
      width 100%
      padding-bottom 100%
      height 0
      position relative
</style>
